package com.online_mall.commodity.controller;

import com.online_mall.commodity.entity.Commodity;
import com.online_mall.commodity.service.CommodityService;
import com.online_mall.uitl.ResultFormat;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Commodity)表控制层
 *
 * @author makejava
 * @since 2025-09-02 15:03:04
 */
@RestController
@RequestMapping("commodity")
public class CommodityController {
    /**
     * 服务对象
     */
    @Resource
    private CommodityService commodityService;

    @RequestMapping(value = "/queryAllCommodity",method = RequestMethod.GET)
    public ResultFormat queryAllCommodity(Commodity commodity){
        return commodityService.queryAll(commodity);
    }

    @RequestMapping(value = "/insertCommodity",method = RequestMethod.GET)
    public ResultFormat insertCommodity(Commodity commodity){
        return commodityService.insert(commodity);
    }

    @RequestMapping(value = "/updateCommodity",method = RequestMethod.GET)
    public ResultFormat updateCommodity(Commodity commodity){
        return commodityService.update(commodity);
    }

    @RequestMapping(value = "/deleteById",method = RequestMethod.GET)
    public ResultFormat deleteById(String commodityId){
        return commodityService.deleteById(commodityId);
    }

    @RequestMapping(value = "/addHeat",method = RequestMethod.GET)
    public ResultFormat addHeat(String commodityId){
        return commodityService.addHeat(commodityId);
    }
}

